package Song.Han.day09.demo01;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

/*
* 题目：
*   计算一个人已经出生了多少天了
* */
public class Demo04Test {
    public static void main(String[] args) throws ParseException {
        bornDays();
    }

    public static void bornDays() throws ParseException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的出生日期如：yyyy-MM-dd");
        String  birtday = sc.next();

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date1 = sdf.parse(birtday);
        Date date2 = new Date();
        long bms = date1.getTime();
        long nms = date2.getTime();

        long days = nms - bms;
        long d = days/92256000;
        sdf.format(d);
        System.out.println("你已经活了"+d+"天了");
    }
}
